
/*!
 * \file      main.cpp
 * \brief     Contains the main function of the program.
 * \author    Duriez Franck
 * \author    Carton Paul-Henri
 * \version   0.1
 */

#include <QtGui/QApplication>
#include <QTextStream>
#include <QFile>
#include <QMessageBox>

#include "assert_macros.h"
#include "constant.h"
#include "mainwindow.h"

/*!
 * \fn int main(int argc, char *argv[])
 * \brief this is the main function of the program.
 */
int main(int argc, char *argv[]) /*{{{*/
{
	QApplication a(argc, argv);

#ifdef DEBUG /*{{{*/
	// Debug management :
	QFile debuglog(DEBUG_LOG_FILE);
	if (debuglog.exists())
	{
		if (!debuglog.remove())
			QMessageBox::critical(NULL,"Erreur",
			                      QString("Impossible de supprimer le fichier ")
			                      + QString(DEBUG_LOG_FILE));
	}
	std::cout << "Debug mode is on !" << std::endl
		<< "The Debug log can be found in this file : "
		<< DEBUG_LOG_FILE << std::endl;
	DEBUGGER("Tetris Debug log :");
#endif /*}}}*/

	// MainWindow creation
	MainWindow* w = new MainWindow;
	// Mainwidow displaying
	w->show();

	// Insertion of the TetrisWidget in the MainWindow
	w->setTetris();

	return a.exec();
} /*}}}*/

/* Documentation tag for Doxygen
 *  */

/*! \mainpage Tetris Documentation
 *
 * \section intro_sec Introduction
 *
 * This is the Tetris project documentation realized by Franck Duriez
 * and Paul-Henri Carton.
 * The aim of this project is to create a library providing tools
 * helping to program easily any kind of Tetris, independently of
 * any graphic library.
 *
 * For the moment, the project is not configured in this way but all
 * the elements are soon present. The library is mixed with the samples.
 * To finish the work, we have to abstract some classes, transform the
 * Qt connector in functors and it will be done.
 * The graphic library used for the sample is SFML, so you need this one
 * to compil the project.
 * Qt4 library is also needed, cause we use Qt signal and slot system.

 * \section downl_section Download Source Code
 *
 * To get the code, you can clone the following git depositary : \n
 * https://code.google.com/p/tetris-fr-ph/
 *
 * \section install_sec Installation
 *
 * \subsection tools_subsec Tools required:
 * - SFML 1.6 (<small><a href="http://www.sfml-dev.org/download.php"> SFML download page </a></small>)
 * - Qt4 (<small><a href="http://qt.nokia.com/downloads/"> Qt4 download page </a></small>)
 *
 * \subsection compil_sec Compilation
 *
 * To compil the project :

 * cd tetris-fr-ph \n
 * make

 * You can choose to compil in debug mode or release mode by changing the
 * DEBUG_MODE variable in the Makefile.
 *
 * \subsection running Running the program
 *
 * To run the program :
 *
 * cd tetris-fr-ph \n
 * ./Tetris_release (if release compilation) \n
 * ./Tetris_debug   (if debug compilation)
 *
 * <BR><BR>
 *
 */
